let Arr = [3, 5, 74, 64, 64, 3, 1, 8, 3, 49, 16, 161, 9, 4]

const mySort = (list) => {
    list.forEach(() => {
        list.forEach((_, index) => {
            if (list[index] > list[index + 1]) {
                [list[index], list[index + 1]] = [list[index + 1], list[index]]
            }
        })
    })
    return list
}

console.log(mySort(Arr))